#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct Chocolate
{
    int morning;
    int evening;
};
bool campare(const Chocolate& a,const Chocolate&b)
{
    return a.morning-a.evening>b.morning-b.evening;
}
int main()
{
    int n,k;
    cin>> n >>k;
    vector<Chocolate> chocolate(n);
    for(int i=0;i<n;i++)
    {
        cin>>chocolate[i].morning;
    }
    for(int i=0;i<n;i++)
    {
        cin>>chocolate[i].evening;
    }
    sort(chocolate.begin(),chocolate.end(),campare);
    long long maxsweet=0;
    for(int i=0;i<k;i++)
    {
        maxsweet+=chocolate[i].morning;
    }
    for(int i=k;i<n;i++)
    {
        maxsweet+=chocolate[i].evening;
    }
    cout <<maxsweet<<endl;
    return 0;

}
